<?php

$line = array('CASE_NUMBER', 'FUTERDATES');
$csv->addRow($line);

foreach($result AS $r)
  {
        
    $line = array($r['pc']['caseid'], $r['pc']['futuredate']);
    $csv->addRow($line);
  }

$datum = date("d.m.Y");
$end = ".csv";
$title = "Export_OPEN_PONDCASES_".$datum.".csv";
echo $csv->render($title);
?>